<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="SuperGRID_WebApp._Default" %>

<%@ Register Assembly="SuperGRID_WebApp" Namespace="SuperGRID_WebApp" TagPrefix="cc2" %>

<%@ Register Assembly="SuperGRID" Namespace="SuperGRID.SuperGridControl" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>

<script type="text/javascript" >
function buildReturn(parentElementName)
{
    var objs = getElementsByAttribute(document, "*", "internalName", "*", parentElementName);
    var XML = new XMLWriter();
    var firstElementID='';
    var createdLine=false;

    XML.BeginNode("returnXML");
    for (var i=0;i<objs.length;i++)
    {
        if (firstElementID==objs[i].getAttribute('internalName') && createdLine)
        {
            XML.EndNode();
            createdLine=false;
        }

        if ((firstElementID==objs[i].getAttribute('internalName') || firstElementID=='') && !createdLine)
        {
            XML.BeginNode("resultLine");
            createdLine=true;
        }

        if (objs[i].getAttribute && objs[i].getAttribute('masterLine'))
        {
            oAttribute = objs[i].getAttribute && objs[i].getAttribute('masterLine');
            if (oAttribute=="false")
            {
                var fieldName= objs[i].getAttribute('internalName');
                var fieldValue=objs[i].value;
                if (firstElementID=='')
                {
                    firstElementID = fieldName;
                }
                XML.Node(fieldName, fieldValue);
            }
        }
    
    }

    XML.Close(); // Takes care of unended tags.
    var myReturnValue="";
    myReturnValue=XML.ToString();
    alert(myReturnValue);
    return false;

}

</script>    


<body>
    <form id="form1" runat="server">
    <div>
        <cc1:SuperGrid ID="SuperGrid1" runat="server">
            <HeaderStyle BackColor="Red" Font-Bold="True" />
            <Columns>
                <cc1:Column HeaderText="teste" Height=""
                    HorizontalAlignment="NotSet" VerticalAlignment="NotSet" Width="">
                    <Controls>
                        <cc1:ColumnControl ID="hehe" ControlType="Text" Height=""
                            HorizontalAlignment="NotSet" VerticalAlignment="NotSet" Width="200px" />
                        <cc1:ColumnControl ID="HUA" ControlType="Text" CSSClass="" DataTextField="" Height=""
                            HorizontalAlignment="NotSet" VerticalAlignment="NotSet" Width="100px" />
                    </Controls>
                </cc1:Column>
            </Columns>
            <RemoveLineTooltip>

Click here to delete this line</RemoveLineTooltip>
            <AddLineTooLinkText>

Add</AddLineTooLinkText>
            <RemoveLineLinkText>

Remove</RemoveLineLinkText>
            <AddLineTooltip>

Click here to add a new line</AddLineTooltip>
        </cc1:SuperGrid>
        &nbsp;</div>
        <asp:Button ID="Button1" runat="server" Text="Button" />
        <input id="Button2" type="button" value="teste" onclick="buildReturn('SuperGrid1');" />&nbsp;</form>
    
    
</body>
</html>
